<?php
/**
 * Created by Zhy
 * User: Zhy
 * Date: 2019/2/14
 * Time: 17:13
 */

namespace app\admin\controller;


use think\Db;
use think\Request;

class Explain extends Base
{
    /**
     * @return mixed|\think\response\Json
     * 用户提现说明
     */
    public function withdrawExplain(){
        if(Request::instance()->isPost()){
            $withdrawExplain = input('withdrawExplain');
            $res = Db::table('up_about_us')->where('about_id', 1)->update(['withdraw_explain' => $withdrawExplain]);
            if($res){
                return json(['code' => 200, 'msg' => '保存成功']);
            }else{
                return json(['code' => 100, 'msg' => '保存失败']);
            }
        }
        $explain = Db::table('up_about_us')->where('about_id', 1)->value('withdraw_explain');
        $this->assign('withdrawExplain', $explain);
        return $this->fetch('explain/withdrawexplain');
    }
    
    /**
     * @return mixed|\think\response\Json
     * 商家充值说明
     */
    public function rechargeExplain(){
        if(Request::instance()->isPost()){
            $rechargeExplain = input('rechargeExplain');
            $res = Db::table('up_about_us')->where('about_id', 1)->update(['recharge_explain' => $rechargeExplain]);
            if($res){
                return json(['code' => 200, 'msg' => '保存成功']);
            }else{
                return json(['code' => 100, 'msg' => '保存失败']);
            }
        }
        $explain = Db::table('up_about_us')->where('about_id', 1)->value('recharge_explain');
        $this->assign('rechargeExplain', $explain);
        return $this->fetch('explain/rechargeexplain');
    }
}